<template>
  <div>
    <section class="aui-flexView">
      <section class="aui-scrollView">
        <div class="aui-sign-head topimg" />
        <div class="aui-sign-form">
          <div class="aui-flex">
            <i class="icon icon-phone" />
            <div class="aui-flex-box">
              <input
                v-model="userid"
                type="text"
                autocomplete="off"
                placeholder="请输入员工编号">
            </div>
          </div>
          <!-- <div class="aui-flex">
            <i class="icon icon-code" />
            <div class="aui-flex-box">
              <input v-model="mima" type="password" autocomplete="off" placeholder="请输入密码" />
            </div>
          </div> -->

          <!-- <p style="heigth:30px;line-height:30px;margin-bottom:15px">
            <input v-model="checkedxy" type="checkbox" />我已阅读并同意
            <span style="color:#5f8cd0" @click="popupVisible=true">《保密协议》</span>
          </p>-->
          <mt-button
            class="aui-sign-login"
            @click="handleLogin">立即登录</mt-button>
        </div>
      </section>
    </section>
  </div>
</template>

<script>
export default {
  layout: 'default',
  data() {
    return {
      userid: '',
      showeditmm: false,
      passwords2: '',
      passwords3: '',
      mima: '',
      ts: this.newStore(),
      username: localStorage.getItem('userid'),
      popupVisible: false,
      popupVisible2: false,
      passwords: localStorage.getItem('passwords'),
      checkedxy: true
    }
  },
  methods: {
    handleLogin() {
      if (this.userid == '' || this.userid == undefined) {
        this.$messagebox('提示', '请输入员工编号')
        return
      }
      const req = {
        handle: 'E299744D88ADCDF5C56442DDF419DB4E6068E69A175433DA',
        userid: this.userid,
        openid: localStorage.getItem('openid')
      }
      this.spost(this.ts, '/mainservlet', req).then(ts => {
        if (ts.d.sflag == 'success') {
          localStorage.setItem('userid', ts.d.data.operation3[0].hash.userid)
          localStorage.setItem(
            'username',
            ts.d.data.operation3[0].hash.username
          )
          localStorage.setItem('pid', ts.d.data.operation3[0].hash.pid)
          localStorage.setItem(
            'deptname',
            ts.d.data.operation3[0].hash.deptname
          )
          localStorage.setItem('token', ts.d.token)
          this.$messagebox('提示', '登录成功').then(action => {
            this.$router.push('/jbrhome')
          })
        }
      })
      // if (this.username == '') {
      //   console.log('wwwwwww');

      //   //this.$MessageBox('请输入用户名')
      //   //return
      // }
      // if (this.passwords == '') {
      //   this.$MessageBox('请输入密码')
      //   return
      // }
      // this.$Indicator.open({
      //   text: '登陆中...',
      //   spinnerType: 'snake'
      // })
      //this.$router.push('/jbrhome')
      // const req = {
      //   handle: 'E299744D88ADCDF5C56442DDF419DB4E33B34DAB6D91425D',
      //   id: this.username,
      //   passwords: this.passwords
      // }
      // this.spost(this.ts, '/mainservlet', req).then(ts => {
      //   this.$indicator.close()
      //   if (ts.d.data.operation4[0].hash.cou == '0') {
      //     localStorage.setItem('token', ts.d.token)
      //     localStorage.setItem('passwords', this.passwords)
      //     localStorage.setItem('userid', ts.d.data.operation3[0].hash.userid)
      //     localStorage.setItem(
      //       'username',
      //       ts.d.data.operation3[0].hash.username
      //     )
      //     this.$router.push('/gztable')
      //   } else {
      //     localStorage.setItem('token', ts.d.token)
      //     this.showeditmm = true
      //   }
      // })
    },
    handleLogin1() {
      if (this.userid == '') {
        console.log('wwwwwww')

        this.$MessageBox('请输入用户名')
        return
      }
      if (this.mima == '') {
        this.$MessageBox('请输入密码')
        return
      }
      this.$Indicator.open({
        text: '登陆中...',
        spinnerType: 'snake'
      })
      const req = {
        handle: 'E299744D88ADCDF5C56442DDF419DB4E33B34DAB6D91425D',
        id: this.userid,
        passwords: this.mima
      }
      this.spost(this.ts, '/mainservlet', req).then(ts => {
        this.$indicator.close()
        if (ts.d.sflag == 'success') {
          localStorage.setItem('token', ts.d.token)
          localStorage.setItem('passwords', this.passwords)
          localStorage.setItem('userid', ts.d.data.operation3[0].hash.userid)
          localStorage.setItem('pid', ts.d.data.operation3[0].hash.pid)
          localStorage.setItem(
            'username',
            ts.d.data.operation3[0].hash.username
          )
          this.$router.push('/jbrhome')
        }
      })
    }
  }
}
</script>

<style scoped>
.topimg {
  background-image: url('../static/head.png');
  background-size: cover;
}
.ptitle {
  height: 30px;
  line-height: 30px;
  text-align: center;
}
.pop1 {
  width: 92%;
  margin: 0 auto;
  height: 80%;
  border-radius: 5px;
}

.divHeight {
  width: 100%;
  height: 10px;
  background: #f5f5f5;
  position: relative;
  overflow: hidden;
}

.r-line {
  position: relative;
}

.r-line:after {
  content: '';
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  height: 100%;
  border-right: 1px solid #d9d9d9;
  -webkit-transform: scaleX(0.5);
  transform: scaleX(0.5);
  -webkit-transform-origin: 100% 0;
  transform-origin: 100% 0;
}

.b-line {
  position: relative;
}

.b-line:after {
  content: '';
  position: absolute;
  z-index: 2;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  border-bottom: 1px solid #e2e2e2;
  -webkit-transform: scaleY(0.5);
  transform: scaleY(0.5);
  -webkit-transform-origin: 0 100%;
  transform-origin: 0 100%;
}
.mint-indicator-wrapper {
  z-index: 999;
}

.aui-flex {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 15px;
  position: relative;
}

.aui-flex-box {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: #333;
}

/* 必要布局样式css */

.aui-flexView {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.aui-scrollView {
  width: 100%;
  height: 100%;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  position: relative;
  margin-top: -44px;
}

.aui-navBar {
  height: 44px;
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  z-index: 102;
  background: none;
}

.aui-navBar-item {
  height: 44px;
  min-width: 25%;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 25%;
  -ms-flex: 0 0 25%;
  flex: 0 0 25%;
  padding: 0 0.9rem;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  color: #808080;
  position: relative;
}

.aui-navBar-item:first-child {
  -webkit-box-ordinal-group: 2;
  -webkit-order: 1;
  -ms-flex-order: 1;
  order: 1;
  margin-right: -25%;
  font-size: 0.9rem;
  font-weight: bold;
}

.aui-navBar-item:last-child {
  -webkit-box-ordinal-group: 4;
  -webkit-order: 3;
  -ms-flex-order: 3;
  order: 3;
  -webkit-box-pack: end;
  -webkit-justify-content: flex-end;
  -ms-flex-pack: end;
  justify-content: flex-end;
}

.aui-center {
  -webkit-box-ordinal-group: 3;
  -webkit-order: 2;
  -ms-flex-order: 2;
  order: 2;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  height: 44px;
  width: 50%;
  margin-left: 25%;
}

.aui-center-title {
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  display: block;
  text-overflow: ellipsis;
  font-size: 0.95rem;
  color: #333;
}

.icon {
  width: 20px;
  height: 20px;
  display: block;
  border: none;
  float: left;
  background-size: 20px;
  background-repeat: no-repeat;
}

.icon-return {
  background-image: url('');
}

.m-slider {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

.slider-wrapper {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  height: 100%;
  -webkit-transform: translate3d(0px, 0px, 0px);
  transform: translate3d(0px, 0px, 0px);
  position: relative;
  z-index: 1;
  -webkit-transition-property: -webkit-transform;
  transition-property: -webkit-transform;
  transition-property: transform;
  transition-property: transform, -webkit-transform;
}

.slider-item {
  width: 100%;
  height: 100%;
  -webkit-flex-shrink: 0;
  -ms-flex-negative: 0;
  flex-shrink: 0;
  background: #f6f6f6;
}

.slider-item img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.slider-pagination {
  text-align: right;
  position: absolute;
  width: 100%;
  z-index: 2;
  right: 0;
  bottom: 10px;
  pointer-events: none;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: end;
  -webkit-align-items: flex-end;
  -ms-flex-align: end;
  align-items: flex-end;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.slider-pagination > .slider-pagination-item {
  margin: 0 0.25rem;
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 100%;
  background-color: rgba(255, 255, 255, 0.4);
}

.slider-pagination > .slider-pagination-item.slider-pagination-item-active {
  background-color: #fff;
  border-radius: 100%;
}

.aui-palace {
  padding: 0.5rem 0;
  position: relative;
  overflow: hidden;
}

.aui-palace-grid {
  position: relative;
  float: left;
  padding: 1px;
  width: 20%;
  box-sizing: border-box;
  margin: 5px 0;
}

.aui-palace-grid-icon {
  width: 30px;
  height: 30px;
  margin: 0 auto;
}

.aui-palace-grid-icon img {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

.aui-palace-grid-text {
  display: block;
  text-align: center;
  color: #333;
  font-size: 0.85rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  padding-top: 0.2rem;
}

.aui-palace-grid-text h2 {
  font-size: 0.8rem;
  font-weight: normal;
  color: #666666;
}

.m-actionsheet {
  text-align: center;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background-color: #efeff4;
  -webkit-transform: translate(0, 100%);
  transform: translate(0, 100%);
  -webkit-transition: -webkit-transform 0.3s;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
}

.mask-black {
  background-color: rgba(0, 0, 0, 0.4);
  position: fixed;
  z-index: 500;
  bottom: 0;
  right: 0;
  left: 0;
  top: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  z-index: 998;
}

.actionsheet-action {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.28rem;
  color: #555;
  height: 1rem;
  line-height: 1rem;
  background-color: #fff;
}

.m-actionsheet {
  text-align: center;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10005;
  background-color: #ffffff;
  -webkit-transform: translate(0, 100%);
  transform: translate(0, 100%);
  -webkit-transition: -webkit-transform 0.3s;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
}

.actionsheet-toggle {
  -webkit-transform: translate(0, 0);
  transform: translate(0, 0);
}

.actionsheet-item {
  display: block;
  position: relative;
  font-size: 0.85rem;
  color: #555;
  height: 2rem;
  line-height: 2rem;
  background-color: #fff;
}

.actionsheet-item {
  display: block;
  position: relative;
  font-size: 0.85rem;
  color: #555;
  height: 2rem;
  line-height: 2rem;
  background-color: #fff;
}

.aui-coll-cancel a {
  height: 45px;
  line-height: 45px;
  font-size: 12px;
  background: #f9f9f9;
  display: block;
  text-align: center;
  width: 100%;
}

.aui-coll-share-img {
  width: 38px;
  height: 38px;
  margin: 0 auto;
}

.aui-coll-share-img img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.aui-coll-share-box {
  position: relative;
  overflow: hidden;
  padding: 10px 0;
}

.aui-coll-cancel a {
  height: 45px;
  line-height: 45px;
  font-size: 12px;
  background: #f9f9f9;
  display: block;
  text-align: center;
  width: 100%;
}

.aui-coll-share-item {
  position: relative;
  float: left;
  padding: 8px 10px;
  width: 33.333%;
  box-sizing: border-box;
  font-size: 12px;
  height: 85px;
}

.aui-rule {
  position: absolute;
  right: 0;
  top: 1rem;
  background: #54ca9a;
  border-radius: 50px 0 0 50px;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  color: #fff;
}

.aui-sign-head {
  width: 100%;
  position: relative;
  height: 300px;
}

.aui-sign-head img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.aui-sign-form {
  width: 92%;
  background-color: white;
  box-shadow: 0 3px 9px #cfcfcf;
  border-radius: 5px;
  margin: -5rem auto;
  z-index: 1;
  position: relative;
  padding: 1.5rem 1rem;
}

.aui-sign-form .aui-flex {
  border: 1px solid #cccccc;
  border-radius: 2px;
  margin: 1.2rem 0;
  padding: 0.2rem 0 0.2rem 0.3rem;
}
.aui-sign-form .aui-flex input {
  width: 100%;
  height: 2rem;
  line-height: 2rem;
  background: none;
  border: none;
  font-size: 0.89rem;
}
.aui-sign-login {
  width: 100%;
  color: #fff;
  font-size: 0.98rem;
  border-radius: 22px;
  background-color: #5f8cd0;
  border: none;
  height: 2.5rem;
  line-height: 2.5rem;
}
.aui-flex-box input {
  outline: none;
}

.aui-code {
  padding-right: 1rem;
}

.aui-sign-form .aui-code input {
  color: #999999;
  font-size: 0.85rem;
}

.icon-phone {
  background-image: url('');
}

.icon-code {
  background-image: url('');
}

.aui-sign-form .aui-flex-clear {
  border: none;
}

.aui-sign-form .aui-flex-clear a {
  color: #999999;
  font-size: 0.85rem;
}
</style>
